<?php
	include "public/commom/config.php";//引入配置连接数据库文件
	include "public/commom/commom.php";//引入配置图片文件
	include "public/commom/timename.php";//引入配置图片文件
	
	if($_POST) {
		$user_id = $_POST["user_id"];
		
		//未读私信数量
		$sql = "SELECT privateletter.* FROM privateletter LEFT JOIN user ON (privateletter.user_id = user.id) WHERE privateletter.user_id = '$user_id' AND privateletter.status = '0'";//sql语句 - 查找该用户所有私信数量
		
		$result = mysqli_query($conn, $sql);//result - 执行sql语句
		
		$prinum = mysqli_num_rows($result);//每个用户私信数量
		
		$_SESSION["chatnum"] = $prinum;
		
		//未读评论数量
		$sql = "SELECT comment.* FROM comment LEFT JOIN user ON (comment.user_id = user.id) LEFT JOIN weibo ON (comment.weibo_id = weibo.id) WHERE weibo.user_id = '$user_id' AND comment.status = '0'";//sql语句 - 查找该用户所有评论数量
		
		$result = mysqli_query($conn, $sql);//result - 执行sql语句
		
		$comnum = mysqli_num_rows($result);//每个用户评论数量
		
		$share = array("prinum" => "$prinum", "comnum" => "$comnum");
		
		echo json_encode($share);
	}
?>